﻿// ===============================================================================
// XmlConfigurationLoadingTest.cs
// EOS Framework
// ===============================================================================
// Copyright (c) EOS Development Group. All rights reserved.
// ===============================================================================

namespace EOS.Framework.Configuration.Tests
{
    using System;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    /// <summary>
    /// This is a test class for XmlConfigurationLoadingTest and is intended
    /// to contain all XmlConfigurationLoadingTest Unit Tests
    /// </summary>
    [TestClass()]
    public class XmlConfigurationLoadingTest
    {
        private TestContext testContextInstance;

        /// <summary>
        /// Gets or sets the test context which provides
        /// information about and functionality for the current test run.
        /// </summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        /// <summary>
        /// A test for Load. FileName cannot be null.
        /// </summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentNullException))]
        public void LoadNullFileNameExceptionTest()
        {
            XmlConfiguration configuration = new XmlConfiguration();
            configuration.Load(null);
        }

        /// <summary>
        /// A test for Load. FileName cannot be empty.
        /// </summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void LoadEmptyFileNameExceptionTest()
        {
            XmlConfiguration configuration = new XmlConfiguration();
            configuration.Load(string.Empty);
        }

        /// <summary>
        /// A test for Load. FileName cannot contain blanks only.
        /// </summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void LoadBlanksOnlyFileNameExceptionTest()
        {
            XmlConfiguration configuration = new XmlConfiguration();
            configuration.Load(" ");
        }

        /// <summary>
        /// A test for Load. Specified xml config file must be a valid xml file.
        /// </summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void LoadWithBrokenFileTest()
        {
            XmlConfiguration configuration = new XmlConfiguration();
            configuration.Load(@"..\..\..\EOS.Framework.Configuration.Tests\TestConfigBroken.xml");
        }

        /// <summary>
        /// A test for Load.
        /// </summary>
        [TestMethod()]
        public void LoadTest()
        {
            XmlConfiguration configuration = new XmlConfiguration();
            configuration.Load(@"..\..\..\EOS.Framework.Configuration.Tests\TestConfig.xml");
        }

        /// <summary>
        /// A test for XmlConfiguration Constructor.
        /// </summary>
        [TestMethod()]
        public void XmlConfigurationConstructorTest()
        {
            string s = GetType().Assembly.Location;
            XmlConfiguration target = new XmlConfiguration();
        }        
    }
}
